using UnityEngine;

public class PlayerJumpAttackState : EntilyState
{

    private bool touchedGround;

    public PlayerJumpAttackState(StateMachine stateMachine, string animBoolName, Player player) : base(stateMachine, animBoolName, player)
    {

    }

    public override void Enter()
    {
        base.Enter();
        touchedGround = false;
        player.SetVelocity(player.JumpAttackVelocity.x*player.facingDir,player.JumpAttackVelocity.y);
    }


    public override void UpDate()
    {
        base.UpDate();

        if (player.groundDetected && touchedGround == false)
        {
            touchedGround = true;
            anim.SetTrigger("JumpAttackTrigger");
            player.SetVelocity(0, rb.linearVelocity.y);
        }
        if (triggerCalled && player.groundDetected)
        {
            stateMachine.ChangeState(player.playerIdleState);
        }

    }


   
}
